/**
 * wikiletter.net Inc.
 * Copyright (c) 2011 All Rights Reserved.
 */
package org.yaya.platform.locker.result;

import org.yaya.platform.locker.enums.LockerResultCodeEnum;

/**
 *                       
 * @Filename: LockerResult.java
 *
 * @Description: 
 *
 * @Version: 1.0
 *
 * @Author: peigen
 *
 * @Email: peigen123@gmail.com
 *
 *       
 * @History:<br>
 *<li>Author: peigen</li>
 *<li>Date: 2011-7-26</li>
 *<li>Version: 1.0</li>
 *<li>Content: create</li>
 *
 */
public class LockerResult {

    private boolean              success = false;

    private long                 lockId  = 0l;

    private LockerResultCodeEnum code    = LockerResultCodeEnum.UN_KNOWN_EXCEPTION;

    private String               errorMsg;

    /**
     * 构建一个空的<code>LockerResult.java</code>
     */
    public LockerResult() {
        super();
        this.success = false;
        this.code = LockerResultCodeEnum.UN_KNOWN_EXCEPTION;
    }

    /**
     * 构建一个空的<code>LockerResult.java</code>
     * @param success
     * @param lockId
     * @param code
     * @param errorMsg
     */
    public LockerResult(boolean success, long lockId, LockerResultCodeEnum code, String errorMsg) {
        super();
        this.success = success;
        this.lockId = lockId;
        this.code = code;
        this.errorMsg = errorMsg;
    }

    /**
     * @return Returns the success
     */
    public boolean isSuccess() {
        return success;
    }

    /**
     * @param success
     * The success to set.
     */
    public void setSuccess(boolean success) {
        this.success = success;
    }

    /**
     * @return Returns the lockId
     */
    public long getLockId() {
        return lockId;
    }

    /**
     * @param lockId
     * The lockId to set.
     */
    public void setLockId(long lockId) {
        this.lockId = lockId;
    }

    /**
     * @return Returns the code
     */
    public LockerResultCodeEnum getCode() {
        return code;
    }

    /**
     * @param code
     * The code to set.
     */
    public void setCode(LockerResultCodeEnum code) {
        this.code = code;
    }

    /**
     * @return Returns the errorMsg
     */
    public String getErrorMsg() {
        return errorMsg;
    }

    /**
     * @param errorMsg
     * The errorMsg to set.
     */
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    /**
     * @return
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return String.format("LockerResult [success=%s, code=%s, errorMsg=%s]", success, code,
            errorMsg);
    }

}
